package com.gxa.modules.pc.fee.controller;

import com.gxa.common.utils.Result;
import com.gxa.modules.pc.fee.dto.OutPatientRechargeDto;
import com.gxa.modules.pc.fee.dto.OutPatientSearchDto;
import com.gxa.modules.pc.fee.service.OutpatientRechargeRecordsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 门诊充值记录表 前端控制器
 * </p>
 *
 * @author gxa
 * @since 2022-11-12 05:31:54
 */


@RestController
@RequestMapping("/rechargerecords")
@Api(tags = "门诊充值记录接口")
public class OutpatientRechargeRecordsController {

    @Autowired
    private OutpatientRechargeRecordsService orrs;



    @PostMapping("/listAll")
    @ApiOperation(value = "查询门诊充值记录",response = OutPatientSearchDto.class)
    public Result list(@RequestBody OutPatientSearchDto outPatientSearchDto) {
        Result result = orrs.queryAll(outPatientSearchDto);
        return result;
    }


    @ApiOperation("门诊充值详情")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query",name = "orderId",value = "订单编号",dataType = "String")
    })
    @GetMapping("/details")
    public Result getDetail(String orderId) {
        Map<String, Object> map = orrs.queryByOrderId(orderId);
        return new Result<>().ok(map);
    }

    @ApiOperation("门诊充值详情中的订单备注添加")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query",name = "orderId",value = "订单编号",dataType = "String"),
            @ApiImplicitParam(paramType = "query",name = "orderNotes",value = "订单备注",dataType = "String")
    })
    @PutMapping("/update")
    public Result getDetail(String orderId,String orderNotes) {
        orrs.updateRemarks(orderId,orderNotes);
        return new Result<>().ok();
    }

}
